<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<script>
			alert(a);//undefined
			var a = 1;
			function sum(){
				
				alert(a);//未声明 1 
				a = 2;
			}
			sum();
			
			alert(a);//2
		</script>
	</body>
</html>
